*******************************************************************************
*** Description: 	This document provides the code for reproducing the 	***
***					figures in the paper, "Does Compulsory Voting Affect    ***
***					How Voters Choose? A Test Using a Combined Conjoint  	***
***					and Regression Discontinuity Analysis," which is		***
***					authored by Shane P. Singh and appears in Comparative	***
***					Political Studies.										***
***					It also provides the code for reproducing statistics 	***
***					associated with claims made in the text.				***
*******************************************************************************


**************
**************
*Set the Version                                                                                                                                 
**************
**************
version 13.1


**************
**************
*Install Required Packages                                                                                                                      
**************
**************
ssc install coefplot 
ssc install grc1leg 


**************
**************
*Increase the maximum number of variables that can be included in Stata's estimation commands.
**************
**************		
set matsize 11000		
		

**************
**************
*Figure 1
**************
**************

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_CPS.dta", clear


***
*Create the graph for those near the age 18 cutoff. 
***

*do the polynomial regressions
lpoly valid_blank_or_null_vote     days_over_18_election if days_over_18_election<0 & days_over_18_election>=-730, nograph gen(sa1 sb1) se(se1) kernel(epanechnikov) bw(150) n(500)
disp r(N)
gen lb1 = sb1 - 1.41*se1 //*1.41 is the critical t for an 84% CI
gen ub1 = sb1 + 1.41*se1 

lpoly valid_blank_or_null_vote     days_over_18_election if days_over_18_election>0 & days_over_18_election<=730, nograph gen(sa0 sb0) se(se0) kernel(epanechnikov) bw(150) n(500)
disp r(N)
gen lb0 = sb0 - 1.41*se0 
gen ub0 = sb0 + 1.41*se0 


*create a turnout variable with different numerical categorizations for graphing purposes
gen voted_graph = valid_blank_or_null_vote
replace voted_graph = 1.01 if valid_blank_or_null_vote == 1
replace voted_graph = .39 if valid_blank_or_null_vote == 0

*make the graph
twoway ///
	scatter voted_graph    days_over_18_election if days_over_18_election>0 & days_over_18_election<=730 , jitter(1.45) jitterseed(999) msymbol(Oh) msize(vsmall) mcolor(black) mlwidth(vthin) || 	///
	scatter voted_graph    days_over_18_election if days_over_18_election<0 & days_over_18_election>=-730 , jitter(1.45) jitterseed(999) msymbol(Oh) msize(vsmall) mcolor(gs8) mlwidth(vthin) || 	///
	line sb0 sa0  if sa0<=730 , lcolor(black) lwidth(medthick) lpattern(solid) || ///
	line sb1 sa1  if sa1>=-730 , lcolor(gs8) lpattern(solid) lwidth(medthick) || 	///
	line ub0 sa0  if sa0<=730 , lcolor(black) lwidth(medium) lpattern(dash) || ///
	line lb0 sa0  if sa0<=730 , lcolor(black) lwidth(medium) lpattern(dash) || 	///
	line ub1 sa1  if sa1>=-730 , lcolor(gs8) lwidth(medium) lpattern(dash) || ///
	line lb1 sa1  if sa1>=-730 , lcolor(gs8) lwidth(medium) lpattern(dash) || ///
	pci .4 0  1.0 0, lcolor(gs3) lwidth(thick) lpattern(solid) yaxis(2) || ///
	, 	xtitle("Days Over Age 18 on Election Day", size(medium)) /// 
		xline(0,  lcolor(gs3) lwidth(thick) lpattern(solid)) ///
		ytitle("Pr(Turned Out)", size(medsmall))   ///   
		legend(off) title("") graphregion(color(white) margin(small))      ///
		scheme(s1color) xsize(6) xscale(range(-735 735)) ysize(5) ylabel(.45(.1)1.0) yscale(range(.38 1.02)) ///
		xlabel(-1100 (275) 1100, labsize(small)) ylabel(, labsize(small)) ///
		ylabel(.4075 `" "Reported" "Abstention" "' .9925 `" "Reported" "Turnout" "',  labsize(vsmall) axis(2))  ytitle("", axis(2)) 	///
		name(lpoly_18_thresh, replace) 

drop sa1-ub0 voted_graph


***
*Create the graph for those near the age 70 cutoff. 
***
lpoly valid_blank_or_null_vote     days_over_70_election if days_over_70_election<0 & days_over_70_election>=-1095, nograph gen(sa1 sb1) se(se1) kernel(epanechnikov) bw(150) n(500)
disp r(N)
gen lb1 = sb1 - 1.41*se1 //*1.41 is the critical t for an 84% CI
gen ub1 = sb1 + 1.41*se1 

lpoly valid_blank_or_null_vote     days_over_70_election if days_over_70_election>0 & days_over_70_election<=1095, nograph gen(sa0 sb0) se(se0) kernel(epanechnikov) bw(150) n(500)
disp r(N)
gen lb0 = sb0 - 1.41*se0 
gen ub0 = sb0 + 1.41*se0 


*create a turnout variable with different numerical categorizations for graphing purposes
gen voted_graph = valid_blank_or_null_vote
replace voted_graph = 1.01 if valid_blank_or_null_vote == 1
replace voted_graph = .39 if valid_blank_or_null_vote == 0

*make the graph
twoway ///
	scatter voted_graph    days_over_70_election if days_over_70_election>0 & days_over_70_election<=1095 , jitter(1.45) jitterseed(999) msymbol(Oh) msize(vsmall) mcolor(gs8) mlwidth(vthin) || 	///
	scatter voted_graph    days_over_70_election if days_over_70_election<0 & days_over_70_election>=-1095 , jitter(1.45) jitterseed(999) msymbol(Oh) msize(vsmall) mcolor(black) mlwidth(vthin) || 	///
	line sb0 sa0  if sa0<=1095 , lcolor(gs8) lwidth(medthick) lpattern(solid) || ///
	line sb1 sa1 if sa1>=-1095 , lcolor(black) lpattern(solid) lwidth(medthick) || 	///
	line ub0 sa0  if sa0<=1095 , lcolor(gs8) lwidth(medium) lpattern(dash) || ///
	line lb0 sa0  if sa0<=1095 , lcolor(gs8) lwidth(medium) lpattern(dash) || 	///
	line ub1 sa1  if sa1>=-1095 , lcolor(black) lwidth(medium) lpattern(dash) || ///
	line lb1 sa1  if sa1>=-1095 , lcolor(black) lwidth(medium) lpattern(dash) || ///
	pci .4 0  1.0 0, lcolor(gs3) lwidth(thick) lpattern(solid) yaxis(2) || ///
	, 	xtitle("Days Over Age 70 on Election Day", size(medium)) /// 
		xline(0,  lcolor(gs3) lwidth(thick) lpattern(solid)) ///
		ytitle("Pr(Turned Out)", size(medsmall))   ///   
		legend(off) title("") graphregion(color(white) margin(small))      ///
		scheme(s1color) xsize(6) xscale(range(-1100 1100)) ysize(5) ylabel(.45(.1)1.0) yscale(range(.38 1.02)) ///
		xlabel(-1100 (275) 1100, labsize(small)) ylabel(, labsize(small)) ///
		ylabel(.4075 `" "Reported" "Abstention" "' .9925 `" "Reported" "Turnout" "',  labsize(vsmall) axis(2))  ytitle("", axis(2)) 	///
		name(lpoly_70_thresh, replace) 		
	
drop sa1-ub0 voted_graph
	
	

***
*Combine the graphs for those near the age 18 and 70 cutoffs. 
***
graph combine  	///
	lpoly_18_thresh 	///
	lpoly_70_thresh 	///
	, rows(1) scheme(s1mono) xcommon ysize(5) xsize(11) scale(1.5) graphregion(margin(zero)) 
		
		
	
	
**************
**************
*Evidence for Claim Made in the Text: "The predicted probability of turnout jumps at age 18, when compulsory voting begins, by about 22 percentage points."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_CPS.dta", clear

***
*Do the analysis.
***
lpoly valid_blank_or_null_vote    days_over_18_election if days_over_18_election<0 & days_over_18_election>=-730, nograph gen(sa1 sb1) se(se1) kernel(epanechnikov) bw(150) n(500)
lpoly valid_blank_or_null_vote    days_over_18_election if days_over_18_election>0 & days_over_18_election<=730, nograph gen(sa0 sb0) se(se0) kernel(epanechnikov) bw(150) n(500)
sum sb0 in 1
global just_above = r(mean)
sum sb1 in 500
global just_below = r(mean)

di $just_above - $just_below

drop sa1-se0 
	

**************
**************
*Evidence for Claim Made in the Text: "At age 70, when compulsory voting ends, [the predicted probability of turnout] drops by about eight points."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_CPS.dta", clear

***
*Do the analysis.
***
lpoly valid_blank_or_null_vote     days_over_70_election if days_over_70_election<0 & days_over_70_election>=-1095, nograph gen(sa1 sb1) se(se1) kernel(epanechnikov) bw(150) n(500)
lpoly valid_blank_or_null_vote     days_over_70_election if days_over_70_election>0 & days_over_70_election<=1095, nograph gen(sa0 sb0) se(se0) kernel(epanechnikov) bw(150) n(500)
sum sb0 in 1
global just_above = r(mean)
sum sb1 in 500
global just_below = r(mean)

di $just_above - $just_below		
		
drop sa1-se0 
		
		
		

**************
**************
*Figure 2
**************
**************

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

		
***
*Reorder the attribute variables for graphing purposes. 
***				
order at_encoded_opinion_deficit at_encoded_opinion_IMF  at_encoded_opinion_abortion at_encoded_experience at_encoded_gender at_encoded_family  at_encoded_favorite_music at_encoded_favorite_food, last 



***
*Calculate the AMCEs for those near the age 18 cutoff and plot them.
***	
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) baselevels
estimates store conjoint_18_thresh

estimates restore conjoint_18_thresh
margins, dydx(at_encoded*) at(days_over_18_election = (0) age_18_or_over_election = (0)) post  base level(95)
estimates store below_18_thresh_AMCE
 
estimates restore conjoint_18_thresh
margins, dydx(at_encoded*) at(days_over_18_election = (0) age_18_or_over_election = (1)) post  base level(95)
estimates store above_18_thresh_AMCE


coefplot 	(below_18_thresh_AMCE, recast(scatter) mcolor(gs8) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(gs8*.55))) /// 			
			(above_18_thresh_AMCE, recast(scatter) mcolor(black) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(black*.55))) /// 
			, 	omitted baselevels ///
				level(95) horizontal format(%9.1f) ///
				xline(0, lcolor(red) lwidth(medium) lpattern(solid)) xtitle("Estimated AMCE", size(medium)) 	///
				ytitle("", size(medium)) ylabel( , labsize(small))		///
				legend(on order(2 "Just Under 18 (Voluntary Voting)" 4 "Just Over 18 (Compulsory Voting)") size(small) rows(2)) title("") graphregion(color(white)) ///
				scheme(s1color) xsize(12) ysize(17) scale(.7) 	///
				xlabel(-0.4(0.1)0.4) xscale(range(-0.4 .4)) ///
				graphregion(color(white) margin(tiny)) ///
					coeflabels( 								///
					0.at_encoded_family  = 				"{bf:Baseline: No Information on Family}"   	///
					0.at_encoded_gender  = 				"{bf:Baseline: Male}"   	///
					0.at_encoded_favorite_music  =  	"{bf:Baseline: No Favorite Type of Music}"   	///
					0.at_encoded_favorite_food =  		"{bf:Baseline: No Favorite Type of Food}"   	///
					0.at_encoded_experience = 	 		"{bf:Baseline: No Experience in Office}"   	///
					0.at_encoded_opinion_abortion = 	"{bf:Baseline: No Position on Abortion}"   	///
					0.at_encoded_opinion_deficit  = 	"{bf:Baseline: No Position on Deficit}" 		/// 
					0.at_encoded_opinion_IMF  = 	 	"{bf:Baseline: No Position on IMF Loans}"   	///
					) ///
				graphregion(margin(small)) ///
				yline(4.5 8.5 11.5 15.5 17.5 22.5 27.5, lcolor(black) lwidth(medthick)) ///
				grid(nogextend) name(conjoint_18_thresh_AMCE, replace)
					

***
*Calculate the marginal means for those near the age 18 cutoff and plot them.
***	
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) baselevels
estimates store conjoint_18_thresh

estimates restore conjoint_18_thresh
margins at_encoded*,  at(days_over_18_election = (0) age_18_or_over_election = (0)) post  base level(84)
estimates store below_18_thresh_MM
 
estimates restore conjoint_18_thresh
margins at_encoded*,  at(days_over_18_election = (0) age_18_or_over_election = (1)) post  base level(84)
estimates store above_18_thresh_MM


coefplot 	(below_18_thresh_MM, recast(scatter) mcolor(gs8) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(gs8*.55))) /// 			
			(above_18_thresh_MM, recast(scatter) mcolor(black) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(black*.55))) /// 
			, 	omitted baselevels ///
				level(84) horizontal format(%9.1f) ///
				xline(0.5, lcolor(red) lwidth(medium) lpattern(solid)) xtitle("Marginal Mean", size(medium)) 	///
				ytitle("", size(medium)) ylabel( , labsize(small))		///
				legend(on order(2 "Just Under 18 (Voluntary Voting)" 4 "Just Over 18 (Compulsory Voting)") size(small) rows(2)) title("") graphregion(color(white)) ///
				scheme(s1color) xsize(12) ysize(17) scale(.7) 	///
				xlabel(.1(.1).9) xscale(range(.1 .9)) ///
				graphregion(color(white) margin(tiny)) ///
					coeflabels( 								///
					0.at_encoded_family  = 				"No Information on Family"   	///
					0.at_encoded_gender  = 				"Male"   	///
					0.at_encoded_favorite_music  =  	"No Favorite Type of Music"   	///
					0.at_encoded_favorite_food =  		"No Favorite Type of Food"   	///
					0.at_encoded_experience = 	 		"No Experience in Office"   	///
					0.at_encoded_opinion_abortion = 	"No Position on Abortion"   	///
					0.at_encoded_opinion_deficit  = 	"No Position on Deficit" 		/// 
					0.at_encoded_opinion_IMF  = 	 	"No Position on IMF Loans"   	///
					) ///
				graphregion(margin(small)) ///
				yline(4.5 8.5 11.5 15.5 17.5 22.5 27.5, lcolor(black) lwidth(medthick)) ///
				grid(nogextend) name(conjoint_18_thresh_MM, replace)
		
		
***
*Combine the AMCE and MM graphs.
***
grc1leg ///
conjoint_18_thresh_AMCE ///
conjoint_18_thresh_MM ///
	,	rows(1) graphregion(margin(none)) scheme(s1mono)  scale(.9) 

*the following lines make some aesthetic adjustments with Graph Editor	
gr_edit .legend.Edit, style(cols(2)) style(rows(0)) keepstyles
gr_edit .legend.Edit, style(labelstyle(size(vsmall)))
gr_edit .legend.xoffset = 9
gr_edit .legend.plotregion1.key[1].view.style.editstyle marker(size(small)) editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle marker(size(small)) editcopy
gr_edit .style.editstyle declared_ysize(8) editcopy
gr_edit .style.editstyle declared_xsize(11) editcopy



**************
**************
*Figure 3
**************
**************

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

		
***
*Reorder the attribute variables for graphing purposes. 
***				
order at_encoded_opinion_deficit at_encoded_opinion_IMF  at_encoded_opinion_abortion at_encoded_experience at_encoded_gender at_encoded_family  at_encoded_favorite_music at_encoded_favorite_food, last 


***
*Calculate the AMCEs for those near the age 70 cutoff and plot them.
***	
reg vote_choice_conjoint  i.age_70_or_over_election##i.at_encoded*##c.days_over_70_election if days_over_70_election>=(-1095) & days_over_70_election<=(1095), cl(respondent) baselevels
estimates store conjoint_70_thresh

estimates restore conjoint_70_thresh
margins, dydx(at_encoded*) at(days_over_70_election = (0) age_70_or_over_election = (0)) post  base level(95)
estimates store below_70_thresh_AMCE
 
estimates restore conjoint_70_thresh
margins, dydx(at_encoded*) at(days_over_70_election = (0) age_70_or_over_election = (1)) post  base level(95)
estimates store above_70_thresh_AMCE


coefplot 	(below_70_thresh_AMCE, recast(scatter) mcolor(black) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(black*.55))) ///
			(above_70_thresh_AMCE, recast(scatter) mcolor(gs8) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(gs8*.55))) /// 			
				, 	omitted baselevels ///
				level(95) horizontal format(%9.1f) ///
				xline(0, lcolor(red) lwidth(medium) lpattern(solid)) xtitle("Estimated AMCE", size(medium)) 	///
				ytitle("", size(medium)) ylabel( , labsize(small))		///
				legend(on order(2 "Just Under 70 (Compulsory Voting)" 4 "Just Over 70 (Voluntary Voting)") size(small) rows(2)) title("") graphregion(color(white)) ///
				scheme(s1color) xsize(12) ysize(17) scale(.7) 	///
				xlabel(-0.4(0.1)0.4) xscale(range(-0.4 .4)) ///
				graphregion(color(white) margin(tiny)) ///
					coeflabels( 								///
					0.at_encoded_family  = 				"{bf:Baseline: No Information on Family}"   	///
					0.at_encoded_gender  = 				"{bf:Baseline: Male}"   	///
					0.at_encoded_favorite_music  =  	"{bf:Baseline: No Favorite Type of Music}"   	///
					0.at_encoded_favorite_food =  		"{bf:Baseline: No Favorite Type of Food}"   	///
					0.at_encoded_experience = 	 		"{bf:Baseline: No Experience in Office}"   	///
					0.at_encoded_opinion_abortion = 	"{bf:Baseline: No Position on Abortion}"   	///
					0.at_encoded_opinion_deficit  = 	"{bf:Baseline: No Position on Deficit}" 		/// 
					0.at_encoded_opinion_IMF  = 	 	"{bf:Baseline: No Position on IMF Loans}"   	///
					) ///
				graphregion(margin(small)) ///
				yline(4.5 8.5 11.5 15.5 17.5 22.5 27.5, lcolor(black) lwidth(medthick)) ///
				grid(nogextend) name(conjoint_70_thresh_AMCE, replace)

				
***
*Calculate the marginal means for those near the age 70 cutoff and plot them.
***		
reg vote_choice_conjoint  i.age_70_or_over_election##i.at_encoded*##c.days_over_70_election if days_over_70_election>=(-1095) & days_over_70_election<=(1095), cl(respondent) baselevels
estimates store conjoint_70_thresh
					
estimates restore conjoint_70_thresh
margins at_encoded*,  at(days_over_70_election = (0) age_70_or_over_election = (0)) post  base level(84)
estimates store below_70_thresh_MM
 
estimates restore conjoint_70_thresh
margins at_encoded*,  at(days_over_70_election = (0) age_70_or_over_election = (1)) post  base level(84)
estimates store above_70_thresh_MM

coefplot 	(below_70_thresh_MM, recast(scatter) mcolor(black) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(black*.55))) ///
			(above_70_thresh_MM, recast(scatter) mcolor(gs8) lpattern(solid) lwidth(medium) ciopts(recast(rspike) lwidth(thin) lcolor(gs8*.55))) /// 			
				, 	omitted baselevels ///
				level(84) horizontal format(%9.1f) ///
				xline(0.5, lcolor(red) lwidth(medium) lpattern(solid)) xtitle("Marginal Mean", size(medium)) 	///
				ytitle("", size(medium)) ylabel( , labsize(small))		///
				legend(on order(2 "Just Under 70 (Compulsory Voting)" 4 "Just Over 70 (Voluntary Voting)") size(small) rows(2)) title("") graphregion(color(white)) ///
				scheme(s1color) xsize(12) ysize(17) scale(.7) 	///
				xlabel(.1(.1).9) xscale(range(.1 .9)) ///
				graphregion(color(white) margin(tiny)) ///
					coeflabels( 								///
					0.at_encoded_family  = 				"No Information on Family"   	///
					0.at_encoded_gender  = 				"Male"   	///
					0.at_encoded_favorite_music  =  	"No Favorite Type of Music"   	///
					0.at_encoded_favorite_food =  		"No Favorite Type of Food"   	///
					0.at_encoded_experience = 	 		"No Experience in Office"   	///
					0.at_encoded_opinion_abortion = 	"No Position on Abortion"   	///
					0.at_encoded_opinion_deficit  = 	"No Position on Deficit" 		/// 
					0.at_encoded_opinion_IMF  = 	 	"No Position on IMF Loans"   	///
					) ///
				graphregion(margin(small)) ///
				yline(4.5 8.5 11.5 15.5 17.5 22.5 27.5, lcolor(black) lwidth(medthick)) ///
				grid(nogextend) name(conjoint_70_thresh_MM, replace)


***
*Combine the AMCE and MM graphs. 
***
grc1leg ///
conjoint_70_thresh_AMCE ///
conjoint_70_thresh_MM ///
	,	rows(1) graphregion(margin(none)) scheme(s1mono)  scale(.9) 

*the following lines make some aesthetic adjustments with Graph Editor	
gr_edit .legend.Edit, style(cols(2)) style(rows(0)) keepstyles
gr_edit .legend.Edit, style(labelstyle(size(vsmall)))
gr_edit .legend.xoffset = 9
gr_edit .legend.plotregion1.key[1].view.style.editstyle marker(size(small)) editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle marker(size(small)) editcopy
gr_edit .style.editstyle declared_ysize(8) editcopy
gr_edit .style.editstyle declared_xsize(11) editcopy

				

				
**************
**************
*Evidence for Claim Made in the Text: "For the younger respondents, a candidate with no position on abortion rights 
*receives significantly more support from those subject to voluntary voting than those subject to compulsory voting
*(the two-sided p-value associated with the difference in the point estimates is 0.026)." 	
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the test.
***				
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) baselevels
margins at_encoded_opinion_abortion,  at(days_over_18_election = (0) age_18_or_over_election = (0 1)) post  base coefleg
test _b[1bn._at#0bn.at_encoded_opinion_abortion] = _b[2._at#0bn.at_encoded_opinion_abortion]		


**************
**************
*Evidence for Claim Made in the Text: "And, [for the younger respondents,] a candidate who feels abortion should be 
*legal gets significantly less support from those subject to voluntary voting than those subject to compulsory voting (p = 0.004)."	
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the test.
***			
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) baselevels
margins at_encoded_opinion_abortion,  at(days_over_18_election = (0) age_18_or_over_election = (0 1)) post  base coefleg
test _b[1bn._at#2.at_encoded_opinion_abortion] = _b[2._at#2.at_encoded_opinion_abortion]


**************
**************
*Evidence for Claim Made in the Text: "Regarding family, [for the younger respondents,] those subject to voluntary voting 
*are less likely to vote for a candidate who has never been married than those for whom voting is mandatory (p = 0.032)."	
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the test.
***			
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) baselevels
margins at_encoded_family,  at(days_over_18_election = (0) age_18_or_over_election = (0 1)) post  base coefleg
test  _b[1bn._at#4.at_encoded_family] = _b[2._at#4.at_encoded_family]


**************
**************
*Evidence for Claim Made in the Text: "Among the older respondents, having a decade of experience in office decreases support 
*for a candidate among those subject to compulsory voting but does not for those subject to voluntary voting (p = 0.003)."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the test.
***			
reg vote_choice_conjoint  i.age_70_or_over_election##i.at_encoded*##c.days_over_70_election if days_over_70_election>=(-1095) & days_over_70_election<=(1095), cl(respondent) baselevels
margins at_encoded_experience,  at(days_over_70_election = (0) age_70_or_over_election = (0 1)) post  base coefleg
test _b[1bn._at#2.at_encoded_experience] = _b[2._at#2.at_encoded_experience]


**************
**************
*Evidence for Claim Made in the Text: "[Among the older respondents,] those subject to voluntary voting tend to reward 
*candidates who express no musical preference, while those for whom voting is mandatory do not (p= 0.031)."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the test.
***			
reg vote_choice_conjoint  i.age_70_or_over_election##i.at_encoded*##c.days_over_70_election if days_over_70_election>=(-1095) & days_over_70_election<=(1095), cl(respondent) baselevels
margins at_encoded_favorite_music,  at(days_over_70_election = (0) age_70_or_over_election = (0 1)) post  base coefleg
test  _b[1bn._at#0bn.at_encoded_favorite_music] = _b[2._at#0bn.at_encoded_favorite_music]


**************
**************
*Evidence for Claim Made in the Text: "Finding that five out of 62 possible pairwise differences in MMs are statistically
*significant at the 5% significance level is not far from what would be expected by random chance if all of the pairwise 
*differences were truly null. In fact, there is a 95.8 percent chance of falsely concluding that at least one of the 
*differences is significant and a 91.1 percent chance of falsely concluding that up to five differences are 
*significant."
**************
**************	
bitesti 62 1 0.05, detail
*or, equivalently:
di 1-.95^62

bitesti 62 5 0.05, detail



**************
**************
*Evidence for Claim Made in the Text: "With a Bonferroni correction for multiple comparisons, the significance level is 
*0.05/62 = 0.0008. None of the 62 possible pairwise differences is statistically significant by this criterion."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear


***
*Age 18 cutoff
***
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) baselevels
margins at_encoded*,  at(days_over_18_election = (0) age_18_or_over_election = (0 1))  post coefleg
test		_b[1bn._at#0bn.at_encoded_opinion_deficit]			=		_b[2._at#0bn.at_encoded_opinion_deficit]		
test		_b[1bn._at#1.at_encoded_opinion_deficit]			=		_b[2._at#1.at_encoded_opinion_deficit]		
test		_b[1bn._at#2.at_encoded_opinion_deficit]			=		_b[2._at#2.at_encoded_opinion_deficit]		
test		_b[1bn._at#3.at_encoded_opinion_deficit]			=		_b[2._at#3.at_encoded_opinion_deficit]		
									
test		_b[1bn._at#0bn.at_encoded_family]					=		_b[2._at#0bn.at_encoded_family]		
test		_b[1bn._at#1.at_encoded_family]						=		_b[2._at#1.at_encoded_family]		
test		_b[1bn._at#2.at_encoded_family]						=		_b[2._at#2.at_encoded_family]		
test		_b[1bn._at#3.at_encoded_family]						=		_b[2._at#3.at_encoded_family]		
test		_b[1bn._at#4.at_encoded_family]						=		_b[2._at#4.at_encoded_family]		
									
test		_b[1bn._at#0bn.at_encoded_gender]					=		_b[2._at#0bn.at_encoded_gender]		
test		_b[1bn._at#1.at_encoded_gender]						=		_b[2._at#1.at_encoded_gender]		
									
test		_b[1bn._at#0bn.at_encoded_favorite_music]			=		_b[2._at#0bn.at_encoded_favorite_music]		
test		_b[1bn._at#1.at_encoded_favorite_music]				=		_b[2._at#1.at_encoded_favorite_music]		
test		_b[1bn._at#2.at_encoded_favorite_music]				=		_b[2._at#2.at_encoded_favorite_music]		
test		_b[1bn._at#3.at_encoded_favorite_music]				=		_b[2._at#3.at_encoded_favorite_music]		
test		_b[1bn._at#4.at_encoded_favorite_music]				=		_b[2._at#4.at_encoded_favorite_music]		
									
test		_b[1bn._at#0bn.at_encoded_favorite_food]			=		_b[2._at#0bn.at_encoded_favorite_food]		
test		_b[1bn._at#1.at_encoded_favorite_food]				=		_b[2._at#1.at_encoded_favorite_food]		
test		_b[1bn._at#2.at_encoded_favorite_food]				=		_b[2._at#2.at_encoded_favorite_food]		
test		_b[1bn._at#3.at_encoded_favorite_food]				=		_b[2._at#3.at_encoded_favorite_food]		
									
test		_b[1bn._at#0bn.at_encoded_experience]				=		_b[2._at#0bn.at_encoded_experience]		
test		_b[1bn._at#1.at_encoded_experience]					=		_b[2._at#1.at_encoded_experience]		
test		_b[1bn._at#2.at_encoded_experience]					=		_b[2._at#2.at_encoded_experience]		
test		_b[1bn._at#3.at_encoded_experience]					=		_b[2._at#3.at_encoded_experience]		
									
test		_b[1bn._at#0bn.at_encoded_opinion_IMF]				=		_b[2._at#0bn.at_encoded_opinion_IMF]		
test		_b[1bn._at#1.at_encoded_opinion_IMF]				=		_b[2._at#1.at_encoded_opinion_IMF]		
test		_b[1bn._at#2.at_encoded_opinion_IMF]				=		_b[2._at#2.at_encoded_opinion_IMF]		
test		_b[1bn._at#3.at_encoded_opinion_IMF]				=		_b[2._at#3.at_encoded_opinion_IMF]		
									
test		_b[1bn._at#0bn.at_encoded_opinion_abortion]			=		_b[2._at#0bn.at_encoded_opinion_abortion]		
test		_b[1bn._at#1.at_encoded_opinion_abortion]			=		_b[2._at#1.at_encoded_opinion_abortion]		
test		_b[1bn._at#2.at_encoded_opinion_abortion]			=		_b[2._at#2.at_encoded_opinion_abortion]		


***
*Age 70 cutoff
***
reg vote_choice_conjoint  i.age_70_or_over_election##i.at_encoded*##c.days_over_70_election if days_over_70_election>=(-1095) & days_over_70_election<=(1095), cl(respondent) baselevels
margins at_encoded*,  at(days_over_70_election = (0) age_70_or_over_election = (0 1))  post coefleg
test		_b[1bn._at#0bn.at_encoded_opinion_deficit]			=		_b[2._at#0bn.at_encoded_opinion_deficit]		
test		_b[1bn._at#1.at_encoded_opinion_deficit]			=		_b[2._at#1.at_encoded_opinion_deficit]		
test		_b[1bn._at#2.at_encoded_opinion_deficit]			=		_b[2._at#2.at_encoded_opinion_deficit]		
test		_b[1bn._at#3.at_encoded_opinion_deficit]			=		_b[2._at#3.at_encoded_opinion_deficit]		
									
test		_b[1bn._at#0bn.at_encoded_family]					=		_b[2._at#0bn.at_encoded_family]		
test		_b[1bn._at#1.at_encoded_family]						=		_b[2._at#1.at_encoded_family]		
test		_b[1bn._at#2.at_encoded_family]						=		_b[2._at#2.at_encoded_family]		
test		_b[1bn._at#3.at_encoded_family]						=		_b[2._at#3.at_encoded_family]		
test		_b[1bn._at#4.at_encoded_family]						=		_b[2._at#4.at_encoded_family]		
									
test		_b[1bn._at#0bn.at_encoded_gender]					=		_b[2._at#0bn.at_encoded_gender]		
test		_b[1bn._at#1.at_encoded_gender]						=		_b[2._at#1.at_encoded_gender]		
									
test		_b[1bn._at#0bn.at_encoded_favorite_music]			=		_b[2._at#0bn.at_encoded_favorite_music]		
test		_b[1bn._at#1.at_encoded_favorite_music]				=		_b[2._at#1.at_encoded_favorite_music]		
test		_b[1bn._at#2.at_encoded_favorite_music]				=		_b[2._at#2.at_encoded_favorite_music]		
test		_b[1bn._at#3.at_encoded_favorite_music]				=		_b[2._at#3.at_encoded_favorite_music]		
test		_b[1bn._at#4.at_encoded_favorite_music]				=		_b[2._at#4.at_encoded_favorite_music]		
									
test		_b[1bn._at#0bn.at_encoded_favorite_food]			=		_b[2._at#0bn.at_encoded_favorite_food]		
test		_b[1bn._at#1.at_encoded_favorite_food]				=		_b[2._at#1.at_encoded_favorite_food]		
test		_b[1bn._at#2.at_encoded_favorite_food]				=		_b[2._at#2.at_encoded_favorite_food]		
test		_b[1bn._at#3.at_encoded_favorite_food]				=		_b[2._at#3.at_encoded_favorite_food]		
									
test		_b[1bn._at#0bn.at_encoded_experience]				=		_b[2._at#0bn.at_encoded_experience]		
test		_b[1bn._at#1.at_encoded_experience]					=		_b[2._at#1.at_encoded_experience]		
test		_b[1bn._at#2.at_encoded_experience]					=		_b[2._at#2.at_encoded_experience]		
test		_b[1bn._at#3.at_encoded_experience]					=		_b[2._at#3.at_encoded_experience]		
									
test		_b[1bn._at#0bn.at_encoded_opinion_IMF]				=		_b[2._at#0bn.at_encoded_opinion_IMF]		
test		_b[1bn._at#1.at_encoded_opinion_IMF]				=		_b[2._at#1.at_encoded_opinion_IMF]		
test		_b[1bn._at#2.at_encoded_opinion_IMF]				=		_b[2._at#2.at_encoded_opinion_IMF]		
test		_b[1bn._at#3.at_encoded_opinion_IMF]				=		_b[2._at#3.at_encoded_opinion_IMF]		
									
test		_b[1bn._at#0bn.at_encoded_opinion_abortion]			=		_b[2._at#0bn.at_encoded_opinion_abortion]		
test		_b[1bn._at#1.at_encoded_opinion_abortion]			=		_b[2._at#1.at_encoded_opinion_abortion]		
test		_b[1bn._at#2.at_encoded_opinion_abortion]			=		_b[2._at#2.at_encoded_opinion_abortion]		



**************
**************
*Evidence for Claim Made in the Text: "In the model that leverages the age 18 threshold, the p-value 
*of the overall F-test is 0.304..."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the test.
***		
reg vote_choice_conjoint  i.age_18_or_over_election##i.at_encoded*##c.days_over_18_election if days_over_18_election>=(-730) & days_over_70_election<=(730), cl(respondent) coefleg

test ///
	_b[1.age_18_or_over_election#1.at_encoded_opinion_deficit] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_opinion_deficit] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_opinion_deficit] = ///
	_b[1.age_18_or_over_election#1.at_encoded_opinion_IMF] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_opinion_IMF] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_opinion_IMF]   =  ///
	_b[1.age_18_or_over_election#1.at_encoded_opinion_abortion] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_opinion_abortion]   =  ///
	_b[1.age_18_or_over_election#1.at_encoded_experience] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_experience] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_experience]   =  ///
	_b[1.age_18_or_over_election#1.at_encoded_gender]   =  ///
	_b[1.age_18_or_over_election#1.at_encoded_family] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_family] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_family] =  ///
	_b[1.age_18_or_over_election#4.at_encoded_family]   =  ///
	_b[1.age_18_or_over_election#1.at_encoded_favorite_music] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_favorite_music] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_favorite_music] =  ///
	_b[1.age_18_or_over_election#4.at_encoded_favorite_music]   =  ///
	_b[1.age_18_or_over_election#1.at_encoded_favorite_food] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_favorite_food] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_favorite_food]   =  0


**************
**************
*Evidence for Claim Made in the Text: "Within each attribute [among the younger group], only the p-value associated 
*with candidates' stances on abortion reaches significance at the 5% level (p = 0.010). 
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the tests.
***		
test ///
	_b[1.age_18_or_over_election#1.at_encoded_opinion_deficit] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_opinion_deficit] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_opinion_deficit] =  0

test ///
	_b[1.age_18_or_over_election#1.at_encoded_opinion_IMF] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_opinion_IMF] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_opinion_IMF] =  0
                                                                     																 
test ///
	_b[1.age_18_or_over_election#1.at_encoded_opinion_abortion] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_opinion_abortion] =  0

test ///
	_b[1.age_18_or_over_election#1.at_encoded_experience] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_experience] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_experience] =  0

test ///
	_b[1.age_18_or_over_election#1.at_encoded_gender] =  0

test ///
	_b[1.age_18_or_over_election#1.at_encoded_family] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_family] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_family] =  ///
	_b[1.age_18_or_over_election#4.at_encoded_family] =  0

test ///
	_b[1.age_18_or_over_election#1.at_encoded_favorite_music] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_favorite_music] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_favorite_music] =  ///
	_b[1.age_18_or_over_election#4.at_encoded_favorite_music] =  0

test ///
	_b[1.age_18_or_over_election#1.at_encoded_favorite_food] =  ///
	_b[1.age_18_or_over_election#2.at_encoded_favorite_food] =  ///
	_b[1.age_18_or_over_election#3.at_encoded_favorite_food] =  0

            		

**************
**************
*Evidence for Claim Made in the Text: "In the model leveraging the age 70 threshold, the p-value 
*of the overall F-test is 0.368."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

reg vote_choice_conjoint  i.age_70_or_over_election##i.at_encoded*##c.days_over_70_election if days_over_70_election>=(-1095) & days_over_70_election<=(1095), cl(respondent) coefleg

***
*Do the test.
***		
test ///
	_b[1.age_70_or_over_election#1.at_encoded_opinion_deficit] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_opinion_deficit] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_opinion_deficit] = ///
	_b[1.age_70_or_over_election#1.at_encoded_opinion_IMF] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_opinion_IMF] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_opinion_IMF]   =  ///
	_b[1.age_70_or_over_election#1.at_encoded_opinion_abortion] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_opinion_abortion]   =  ///
	_b[1.age_70_or_over_election#1.at_encoded_experience] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_experience] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_experience]   =  ///
	_b[1.age_70_or_over_election#1.at_encoded_gender]   =  ///
	_b[1.age_70_or_over_election#1.at_encoded_family] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_family] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_family] =  ///
	_b[1.age_70_or_over_election#4.at_encoded_family]   =  ///
	_b[1.age_70_or_over_election#1.at_encoded_favorite_music] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_favorite_music] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_favorite_music] =  ///
	_b[1.age_70_or_over_election#4.at_encoded_favorite_music]   =  ///
	_b[1.age_70_or_over_election#1.at_encoded_favorite_food] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_favorite_food] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_favorite_food]   =  0
	
	
**************
**************
*Evidence for Claim Made in the Text: "Within the attributes [among the older group], only the p-value associated 
*with candidates' experience in office is significant at the 5% level (p = 0.037)."
**************
**************	

***
*Open the required data set.
***
use "Argentina_2019_Gen_Elec_Survey_Conjoint_CPS.dta", clear

***
*Do the tests.
***		
test ///
	_b[1.age_70_or_over_election#1.at_encoded_opinion_deficit] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_opinion_deficit] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_opinion_deficit] =  0

test ///
	_b[1.age_70_or_over_election#1.at_encoded_opinion_IMF] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_opinion_IMF] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_opinion_IMF] =  0
                                                                     																 
test ///
	_b[1.age_70_or_over_election#1.at_encoded_opinion_abortion] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_opinion_abortion] =  0

test ///
	_b[1.age_70_or_over_election#1.at_encoded_experience] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_experience] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_experience] =  0

test ///
	_b[1.age_70_or_over_election#1.at_encoded_gender] =  0

test ///
	_b[1.age_70_or_over_election#1.at_encoded_family] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_family] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_family] =  ///
	_b[1.age_70_or_over_election#4.at_encoded_family] =  0

test ///
	_b[1.age_70_or_over_election#1.at_encoded_favorite_music] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_favorite_music] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_favorite_music] =  ///
	_b[1.age_70_or_over_election#4.at_encoded_favorite_music] =  0

test ///
	_b[1.age_70_or_over_election#1.at_encoded_favorite_food] =  ///
	_b[1.age_70_or_over_election#2.at_encoded_favorite_food] =  ///
	_b[1.age_70_or_over_election#3.at_encoded_favorite_food] =  0



	
	
	
*|\   \\\\__     o
*| \_/    o_\    o 
*> _   (( <_  oo  Thanks for replicating!
*| / \__+___/      
*|/     |/	
	

